﻿using UnityEngine;
using System.Collections;

public class Skeleton : MonoBehaviour 
{
    public GameObject enemy;

    public GameObject explosion;

    public float healthHideSkeleton;

    private EnemyController enemyController;

    public Transform ExplosionSkeleton; 

    void Awake()
    {
        enemyController=enemy.GetComponent<EnemyController>();
        
    }
    void Update()
    {
        if (enemyController.status.Health <= healthHideSkeleton)
        {
            gameObject.SetActive(false);
            Instantiate(explosion, ExplosionSkeleton.position, explosion.transform.rotation);
        }
    }

 
}
